﻿using God.ShoppingWebApi.Enums;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Domain.Entities.Auditing;

namespace God.ShoppingWebApi.Entities
{
    public class Order : AuditedEntity<Guid>
    {
        //订单编号
        [StringLength(50)]
        public string OrderNo { get; set; }

        //下单时间
        public DateTime CreateTime { get; set; }

        //订单状态
        public OrderStatusEnum OrderStatus { get; set; }

        #region 支付信息
        //支付方式 1：在线支付 2：货到付款
        public PayEnum PayType { get; set; }

        //支付时间
        public DateTime? PayTime { get; set; }
        #endregion

        #region 配送信息
        //配送方式 1： 京东快递  2：顺丰快递
        public DeliveryEnum ShippingType { get; set; }

        //期望配送时间
        public DateTime? ShippingTime { get; set; }

        //收货人地址Id
        //public int ReceiverId { get; set; }
        #endregion
        //导航属性-物流信息
        //public virtual List<Logistics> LogisticsInfo { get; set; }

        //导航属性-订单明细
        public virtual List<OrderItem> OrderItems { get; set; }

        public Order()
        {

        }
        public Order(Guid guid, string orderNo,  OrderStatusEnum orderStatus, PayEnum payType, DeliveryEnum shippingType, Guid? lastfierId)
        {
            Id = guid;
            OrderNo = orderNo;
            CreateTime = DateTime.Now;
            OrderStatus = orderStatus;
            PayType = payType;
            ShippingType = shippingType;
            PayTime = DateTime.Now;
            ShippingTime = DateTime.Now;
            CreatorId = lastfierId;
            LastModifierId = lastfierId;
        }
    }
}
